<%@page import="${basepackage}.model.*" %>
<#include "/macro.include"/> 
<#include "/custom.include"/> 
<#assign className = table.className>   
<#assign classNameLowerCase = className?lower_case>

<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib tagdir="/WEB-INF/tags/simpletable" prefix="simpletable"%>
<%@ include file="/commons/taglibs.jsp" %>

<c:set var="ctx" value="<@jspEl 'pageContext.request.contextPath'/>"/>

<rapid:override name="head">
	<title><%=${className}.TABLE_ALIAS%> 维护</title>
	<script type="text/javascript" >
		function addOrEdit(url) {
			showDialogByUrl(url,'<%=${className}.TABLE_ALIAS%>',650,600);
        }
		
		document.onkeydown = function(){ 
			if (event.keyCode == 13) 
			{ 
				document.queryForm.action='<@jspEl 'ctx'/>/${classNameLowerCase}';
				document.queryForm.submit();
			} 
		};
	</script>
</rapid:override>
<rapid:override name="toolbar">
	<div style="padding-top:5px;">
		<table width="830">
		<tr>
			<td style="width:50%;">
			<image src="<@jspEl 'ctx'/>/styles/images/btnNew.png" class="stdButton" onclick="javascript:addOrEdit('<@jspEl 'ctx'/>/${classNameLowerCase}/new')"/>
			<image src="<@jspEl 'ctx'/>/styles/images/btnDel.png" class="stdButton" onclick="javascript:doRestBatchDelete('<@jspEl 'ctx'/>/${classNameLowerCase}','items',document.forms.queryForm)"/>
			<image src="<@jspEl 'ctx'/>/styles/images/btnRefresh.png" class="stdButton" onclick="javascript:location.reload();"/>
			</td>
		</tr>
		</table>	
	</div>
</rapid:override>
<rapid:override name="content">
	<div>
	<table id="rounded-corner" class="gridBody" style="width:823;">
		  <thead>
			  <tr id="thline">
				<th scope="col" style="width:1px;"><input type="checkbox" onclick="setAllCheckboxState('items',this.checked)"></th>
				<#list table.columns as column>
				<#if !column.htmlHidden>
				<th scope="col" sortColumn="${column.sqlName}" ><%=${className}.ALIAS_${column.constantName}%></th>
				</#if>
				</#list>
				<th scope="col">操作</th>
			  </tr>
		  </thead>
		  <tbody>
			  <tr id="trsearch">
			   	<td style="padding: 0px 8px;" align="right"></td>
				<#list table.columns as column>
				<#if !column.htmlHidden>
			   	<td style="padding: 0px 8px;"><input value="<@jspEl "query."+column.columnNameLower/>" id="${column.columnNameLower}" name="${column.columnNameLower}" size="2"/></td>
				</#if>
				</#list>			   	
			   	<td style="padding: 0px 8px;"><a href="javascript:resetAndReload('<@jspEl 'ctx'/>/${classNameLowerCase}');">清除</a></td>
			  </tr>		  
		  	  <c:forEach items="<@jspEl 'page.result'/>" var="item" varStatus="status">
			  <tr>
				<td><input type="checkbox" name="items" value="<@jspEl 'item.' + table.pkColumn.columnNameLower/>"><@jspEl 'page.thisPageFirstElementNumber + status.index'/></td>
				<#list table.columns as column>
				<#if !column.htmlHidden>
				<td><#rt><#compress><c:out value='<@jspEl "item."+column.columnNameLower/>'/>&nbsp;</#compress><#lt></td>
				</#if>
				</#list>
				<td>
					<a href="javascript:addOrEdit('<@jspEl 'ctx'/>/${classNameLowerCase}/<@jspEl 'item.'+table.idColumn.columnNameFirstLower/>')">查看</a>&nbsp;&nbsp;
					<a href="javascript:addOrEdit('<@jspEl 'ctx'/>/${classNameLowerCase}/<@jspEl 'item.'+table.idColumn.columnNameFirstLower/>/edit')">修改</a>&nbsp;&nbsp;
					<a href="<@jspEl 'ctx'/>/${classNameLowerCase}/<@jspEl 'item.'+table.idColumn.columnNameFirstLower/>" onclick="doRestDelete(this,'您确认删除?');return false;">删除</a>
				</td>
			  </tr>
		  	  </c:forEach>
		  </tbody>
		  <tfoot><tr><td colspan="8" align="center">
		  <simpletable:pageToolbar page="<@jspEl 'page'/>"></simpletable:pageToolbar>
		  </td></tr></tfoot>
		</table>
	</div>
</rapid:override>

<%@ include file="/baseList.jsp" %>
